{% extends "base.html" %}

{% block additional_title %}
Profil
{% endblock %}

{% block additional_head %}
<script type="text/javascript" id="js" language="javascript">
	$(document).ready(function(){
		$("#id_send_mail").click(toggle_mail_textbox);
		toggle_mail_textbox();
	});

	function toggle_mail_textbox() {
		var checked = $('#id_send_mail').is(':checked');
		if (checked) {
			$('#id_email').attr("disabled", false);
		} else {
			$('#id_email').attr("disabled", true);
		}
	}
</script>
{% endblock %}

{% block content %}

<center>
	<h1>{{ user.first_name }} {{ user.last_name }}</h1>
	<br/>
	{% if user.get_profile.image %}
		<img src="{{ user.get_profile.image.url }}" height="200" alt="{{ user.username }}"></img>
	{% else %}
		<img src="{{ settings.MEDIA_URL }}images/users/unknown.jpg" width="200" height="200" alt="unknown"></img>
	{% endif %}
	
	<br/>

	<h2>Promena profila</h2>
	<a href="/mdcs/profile/password_change/">Promena lozinke</a>
	<br/><br/>
	
	{{ form.non_field_errors }}
	<form enctype="multipart/form-data" action="" method="POST">
		<table>
			<tbody>
				<tr>
					<th align="left"><label for="id_image">Slika:</label></th>
					<td>{{ form.image }}</td>
					<td>{{ form.image.errors }}</td>
				</tr>
				<tr>
					<th align="left"><label for="id_chess_recommended">Uključi me u šahovske preporučene mečeve:</label></th>
					<td>{{ form.chess_recommended }}</td>
					<td>{{ form.chess_recommended.errors }}</td>
				</tr>
				<tr>
					<th align="left"><label for="id_tf_recommended">Uključi me u preporučene mečeve za stoni fudbal:</label></th>
					<td>{{ form.tf_recommended }}</td>
					<td>{{ form.tf_recommended.errors }}</td>
				</tr>
				<tr>
					<th align="left"><label for="id_send_mail">Primanje e-mail-ova:</label></th>
					<td>{{ form.send_mail }}</td>
					<td>{{ form.send_mail.errors }}</td>
				</tr>
				<tr>
					<th align="left"><label for="id_email">E-mail:</label></th>
					<td>{{ form.email }}</td>
					<td>{{ form.email.errors }}</td>
				</tr>
			</tbody>
		</table>
		<input type="submit" value="Promeni"/>
	</form>
</center>

{% endblock %}
